/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ca.biosample.robot.gui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GridLayout;
import javax.swing.JPanel;
import javax.swing.border.LineBorder;
import javax.swing.border.TitledBorder;

/**
 *
 * @author mvs
 */
public class SourceTubePanel extends TubePanel {

    //private SourceTubeIcon selected;
    //private final int NUM_ROWS;
    //private final int NUM_COLS;
    //public SourceTubeIcon tubes[];
    
    public SourceTubePanel(int rows, int cols, String _name) {
    	super(rows,cols,_name);
        /*NUM_ROWS = rows;
        NUM_COLS = cols;
        selected = null;
        this.setPreferredSize(new Dimension(300,600));
        //tubePanel.setMinimumSize(new Dimension(200,400));
        GridLayout tpLayout = new GridLayout(10,5);
        tpLayout.setHgap(5);
        tpLayout.setVgap(5);
        TitledBorder tpBorder = new TitledBorder(new LineBorder(Color.BLACK), name);
        tpBorder.setTitleJustification(TitledBorder.CENTER);
        this.setBorder(tpBorder);
        this.setLayout(tpLayout);
        
        tubes = new SourceTubeIcon[NUM_ROWS * NUM_COLS];
        for(int i = 0; i < NUM_ROWS * NUM_COLS; i++) {
            if(i < 10)
                tubes[i] = new SourceTubeIcon(i + 1, new SampleInfo("TS032400" + i, "BLAH", "Plasma"));
            else if(i < 20)
                tubes[i] = new SourceTubeIcon(i + 1, new SampleInfo("TS000" + i, "BLAH", "Whole Blood"));
            else if(i < 30)
                tubes[i] = new SourceTubeIcon(i + 1, new SampleInfo("9980" + i, "BLAH", "White Blood"));
            else if(i < 40)
                tubes[i] = new SourceTubeIcon(i + 1, new SampleInfo("9950" + i, "BLAH", "RNA"));
            else if(i < 50)
                tubes[i] = new SourceTubeIcon(i + 1);
            tubes[i].setVisible(true);
            this.add(tubes[i]);
        }*/
    }
    
    /*public void setSelected(SourceTubeIcon sel) {
        if(sel.getParent() != this) {
            selected = null;
            return;
        }
        selected = sel;
    }
    
    @Override
    public void paint(Graphics g) {
        super.paint(g);
        if(selected != null) {
            int x = selected.getX();
            int y = selected.getY();
            int w = selected.getWidth();
            int h = selected.getHeight();
            g.setColor(Color.BLUE);
            g.drawRect(x - 3, y - 3, w + 5, h + 5);
            g.drawRect(x - 2, y - 2, w + 3, h + 3);
            g.drawRect(x - 1, y - 1, w + 1, h + 1);
            selected.repaint();
        }
    }*/
}
